From 0d6ef06bc4220a57af14906e54ae555caa653631 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Sun, 29 Jul 2007 23:53:45 +0000 Subject: [PATCH] Introduce OutputPage::addReturnTo(), with a view to replacing OutputPage::returnToMain() [cleaner calling convention], and document the latter --- includes/OutputPage.php | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index cecff52f30..894134a8af 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1059,12 +1059,25 @@ class OutputPage { } /** - * return from error messages or notes - * @param $unused No longer used - * @param $returnto page title to return to. Default is Main Page. + * Add a "return to" link pointing to a specified title + * + * @param Title $title Title to link + */ + public function addReturnTo( $title ) { + global $wgUser; + $link = wfMsg( 'returnto', $wgUser->getSkin()->makeLinkObj( $title ) ); + $this->addHtml( "

{$link}

\n" ); + } + + /** + * Add a "return to" link pointing to a specified title, + * or the title indicated in the request, or else the main page + * + * @param null $unused No longer used + * @param Title $returnto Title to return to */ public function returnToMain( $unused = null, $returnto = NULL ) { - global $wgUser, $wgOut, $wgRequest; + global $wgRequest; if ( $returnto == NULL ) { $returnto = $wgRequest->getText( 'returnto' ); @@ -1083,11 +1096,7 @@ class OutputPage { $titleObj = Title::newMainPage(); } - $sk = $wgUser->getSkin(); - $link = $sk->makeLinkObj( $titleObj, '' ); - - $r = wfMsg( 'returnto', $link ); - $wgOut->addHTML( "\n

$r

\n" ); + $this->addReturnTo( $titleObj ); } /** -- 2.20.1